package com.demo.springBootDemo10.web;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

@RestController
public class IndexController {

	@ApiOperation(value = "首页")
	@RequestMapping(value="/", method = RequestMethod.GET)
	public Object index() {
		return "welcome";
	}

	@ApiOperation(value = "sayHello")
	@ApiImplicitParam(paramType = "path", name = "name", value = "姓名", required = true, dataType = "String")	//写基本类型名
	@RequestMapping(value = "/hello/{name}", method = RequestMethod.GET)
	public Object hello(@PathVariable("name") String name) {
		return String.format("Hello,%s", name);
	}

}
